<template>
  <div>
    <el-aside width="240px" class="aside_rolelist">
      <div class="asidelist">
        <div class="hd">
          <div>票种类型</div>
          <div>
            <el-button
              class="header-icon el-icon-plus"
              type="primary"
              plain
              @click="dialogVisible=true"
            >添加</el-button>
          </div>
        </div>
        <div class="role-container" id="rolelist">
          <el-tree
            :data="dataList"
            show-checkbox
            node-key="id"
            :highlight-current="true"
            @node-click="nodebg"
            :expand-on-click-node="false"
            :props="defaultProps"
          >
            <span class="custom-tree-node" slot-scope="{ node }">
              <span class="treefont" >{{ node.label }}</span>
            </span>
          </el-tree>
        </div>
      </div>
    </el-aside>
  </div>
</template>
<script>
export default {
  data() {
    return {
      dataList: [],
      defaultProps: {
        label: "name"
      },
      dialogVisible: false,
    };
  },
  created(){
    this.getData();
  },
  methods: {
    nodebg(data) {
      console.log(data.ticketTypeId)
      this.$emit("getTicketTypeId", data.ticketTypeId);
    },
    getData() {
      this.$axios.get('/TicketType/Project/'+localStorage.getItem('project_Id')).then(res =>{
        if (res.data.hasError == false) {
          this.dataList = [...res.data.data]
        }
      })
    }
  }
};
</script>
<style lang="scss" scope>
.asidelist {
  background-color: #fff;
  border-radius: 5px;
  width: 100%;
  height: 100%;
  .hd {
    height: 60px;
    border-bottom: 1px solid #ebeef5;
    box-sizing: border-box;
    padding: 0 10px;
    line-height: 60px;
    display: flex;
    justify-content: space-between;
  }
  .el-tree-node__expand-icon.is-leaf {
    color: f2f2f2;
  }
  .custom-tree-node {
    flex: 1;
    display: flex;
    align-items: center;
    justify-content: space-between;
    font-size: 14px;
    padding-right: 18px;
  }
  .el-checkbox__inner {
    width: 0;
  }
  .el-tree-node__content {
    height: 40px;
  }
}
.aside_rolelist {
  height: 100%;
}
.el-dialog {
  .el-dialog__body{
    padding: 20px;
  }
  height: calc(100% - 200px);
  box-sizing: border-box;
  overflow: auto;
}
</style>